<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class Index extends CI_Controller {

	//Doctrine EntityManager
	public $em;
	
	public function __construct()
	{
		parent::__construct();
		
		//Instantiate a Doctrine Entity Manager
		$this->em = $this->doctrine->em;
	}

	public function index()
	{   		
		$subject = $this->em->find('models\Subject', 4);
		$new_sub = $this->em->find('models\Subject', 3);
		
		//print_r($new_sub->getPrerequisites()->toArray());
		
		//$subject->removePrerequisite($new_sub);
		//$this->em->flush();
		
		$user = $this->em->find('models\User', 1);
		
		$data['subject'] = $subject;
		$data['prerequisites'] = $subject->getPrerequisites()->toArray();
		
		$data['site_name'] = 'Silliman CCS';
		$data['page_title'] = 'Index page';
		$data['app_name'] = 'aSPl';
		$data['user_login'] = $user->getUserLogin();
		$data['aspl_version'] = '1.0.0';
		
		// Load the template from the views directory
		$this->parser->parse("index.tpl", $data);
	}

}
